/*
 * @Author: Klein
 * @Date: 2021-06-17 11:07:28
 * @Description: file content
 */
const router = require("koa-router")();
router.prefix("/users");
const UserController = require("../controller/user");
const { koaJwt } = require("../lib/token");

// token校验-权限控制
router.use(koaJwt);

/**
 * @description: 用户注册
 */
router.post(
  "/register",
  UserController.validate,
  UserController.pswBcrypt,
  UserController.complete
);

/**
 * @description: 用户登录
 */
router.post("/login", UserController.login);

/**
 * @description: 根据token查询用户信息
 */
router.get("/details", UserController.view);

module.exports = router;
